<template>
    <div class="record">
      <avue-crud :option="option"
                 :table-loading="tableLoading"
                 :data="tableData"
                 :page.sync="page"
                 ref="crud"
                 @on-load="onLoad"

      ><!--@selection-change="selectionChange"-->

        <!--<template slot-scope="scope" slot="menu">
          <el-button icon="el-icon-view"
                     @click="handleRead(scope.row)"
                     type="text">查看</el-button>
          <el-button icon="el-icon-download"
                     @click="handleDownload(scope.row)"
                     type="text">下载</el-button>
        </template>-->

      </avue-crud>
    </div>
</template>

<script>
import { requestAlarmRecord } from '../../../../../api/house/temperature'

export default {
  name: 'alarmRecord',
  data () {
    return {
      tableLoading: false,
      page: {
        pageSize: 20,
        currentPage: 1,
        pageSizes: [20, 40, 60, 80],
        total: 0
      },
      tableData: [],
      option: {
        align: 'center',
        menuAlign: 'center',
        header: false,
        border: true,
        size: 'medium',
        height: 'calc(100vh - 150px)',
        index: true, // 显示序号
        indexLabel: '序号', // 显示序号
        selection: true, // 多选
        editBtn: false, // 行内编辑按钮
        delBtn: false, // 行内删除按钮
        viewBtn: false, // 行内查看按钮
        menu: false,
        menuWidth: 135,
        column: [
          {
            label: '库房',
            prop: 'storageRoom',
            overHidden: true
          },
          {
            label: '温度',
            prop: 'temperatures',
            overHidden: true
          },
          {
            label: '湿度',
            prop: 'humiditys',
            overHidden: true
          }
        ]
      }
    }
  },
  methods: {
    onLoad () {
      const param = {
        pageNo: this.page.currentPage,
        pageSize: this.page.pageSize
      }

      this.tableLoading = true
      requestAlarmRecord(param).then(res => {
        this.tableData = res.data.data.list
        this.page.total = Number(res.data.data.total)
        this.tableLoading = false
      }).catch(() => {
        this.tableLoading = false
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.record{
  padding: 0 15px;
}
</style>
